package com.badger.jvm;

import java.util.ArrayList;
import java.util.List;

/**
 * 堆内存溢出
 * @author liqi
 * VM Args: 
 * -Xms20m -Xmx20m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Users/liqi/Downloads
 */
public class HeapOOM {

    static class OOMObject{}
    
    public static void main(String[] args) {
        List<OOMObject> list = new ArrayList<>();
        while (true) {
           list.add(new OOMObject());
        }
    }
}
